package com.py.credit.ai.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

import com.baidu.aip.face.AipFace;
import com.baidu.aip.ocr.AipOcr;

@Configuration
@PropertySource(value = "classpath:/application.properties", ignoreResourceNotFound = false)
public class AipClientConfig {

	@Autowired
	Environment env;

	@Bean
	public AipFace aipFaceClient() {

		AipFace aipFace = new AipFace(env.getProperty("ai.app.id"), env.getProperty("ai.api.key"),
				env.getProperty("ai.secret.key"));

		return aipFace;
	}

	@Bean
	public AipOcr aipOrcClient() {

		AipOcr aiOcr = new AipOcr(env.getProperty("ai.app.id"), env.getProperty("ai.api.key"),
				env.getProperty("ai.secret.key"));

		return aiOcr;
	}

}
